package com.sparrow.source.persistense.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sparrow.source.common.dto.ReportDeviceChannel;
import com.sparrow.source.common.dto.ReportTable;
import com.sparrow.source.persistense.IasVerifyReport;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * @author bryceyung
 * @since 2024/11/25
 */
public interface IasVerifyReportMapper extends BaseMapper<IasVerifyReport> {

    /**
     * 校验用户当日是否打卡
     *
     * @param channelFlag
     * @param uid
     * @return
     */
    Boolean haveCheckedInCurdate(@Param("channelFlag") Integer channelFlag, @Param("uid") Long uid);

    /**
     * 查询分页列表
     *
     * @param beginTime
     * @param endTime
     * @param deviceName
     * @param userName
     * @param checkType
     * @param matchRes
     * @param page
     * @return
     */
    Page<ReportTable> selectReportTable(@Param("beginTime") String beginTime, @Param("endTime") String endTime,
            @Param("deviceName") String deviceName, @Param("userName") String userName, @Param("checkType") Integer checkType,
            @Param("matchRes") Integer matchRes,
            Page<ReportTable> page);

    /**
     * 查询近一周所有设备通道打卡 上班打卡的次数
     *
     * @param channelFlag
     * @return
     */
    List<ReportDeviceChannel> selectDeviceChannel(@Param("channelFlag") Integer channelFlag);

    List<ReportDeviceChannel> selectCheckCountWeekly();

    List<ReportDeviceChannel> selectCurrDateCheck(@Param("beginDate") String beginDate,@Param("endDate") String endDate, @Param("deviceId") Integer deviceId);
}
